package com.ywjt.platformbusiness.market.hagglegoods.adapter;

import android.graphics.Paint;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.market.hagglegoods.model.GroupListModel;

import java.util.List;

public class HaggleGoodsAdapter extends BaseQuickAdapter<GroupListModel.ResultDTO.RecordsDTO, BaseViewHolder> {

    public HaggleGoodsAdapter(@Nullable List<GroupListModel.ResultDTO.RecordsDTO> data) {
        super(R.layout.item_hagglegoods, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GroupListModel.ResultDTO.RecordsDTO item) {
        ImageView ivGoodsImg=helper.getView(R.id.ivGoodsImg);
        Glide.with(mContext).load(item.getCommodityMessage().getMainPhoto())
                .into(ivGoodsImg);
        TextView tvOldPrice=helper.getView(R.id.tvOldPrice);
        tvOldPrice.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG );
        helper.setText(R.id.tvOldPrice,"¥"+item.getCommodityMessage().getPrice());
        helper.setText(R.id.tvPrice,"¥"+item.getPrice());
        helper.setText(R.id.tvGoodsName,item.getCommodityMessage().getName());
        helper.setText(R.id.tvGroupedNum,"已拼"+(item.getGroupNum()==null?0:item.getGroupNum())+"件");
    }
}